#ifndef CVERTEX_H
#define CVERTEX_H

class CEdge;
class CFace;
class CMesh;

// STD
#include <vector>
#include "QVector"

// PROJECT
#include "cpoint3f.h"
#include "cedge.h"
#include "cface.h"
#include "cmesh.h"


class CVertex
{
public:
	CVertex();
	CVertex(const CVertex &);
	CVertex(double, double, double, CMesh * = NULL);
	CVertex(CPoint3f, CMesh * = NULL);

	double				getX();
	double				getY();
	double				getZ();
	CPoint3f			getPosition();
	double				getOriginalX();
	double				getOriginalY();
	double				getOriginalZ();
	CPoint3f			getOriginalPosition();
	double				getAimX();
	double				getAimY();
	double				getAimZ();
	CPoint3f			getAimPosition();
	CPoint3f			getNormal();
	bool				isNormalSet();
	CMesh *				getParentMesh();

	void				setX(double);
	void				setY(double);
	void				setZ(double);

	void				setPosition (double, double, double);
	void				setPosition (CPoint3f);
	void				setAimPosition (double, double, double);
	void				setAimPosition (CPoint3f);
	void				setNormal (double, double, double);
	void				setNormal (CPoint3f);
	void				SetParentMesh(CMesh *);

	void				addEdge(CEdge *);
	void				addFace(CFace *);
	void				removeEdge(CEdge *);
	void				removeFace(CFace *);

	void				computeNormal();

	void				clearEdgelist();
	void				clearFaceList();

	std::vector<CEdge*>	m_EdgeList;
	QVector<CFace*>		m_FaceList;
protected:
	CPoint3f			m_Position;
	CPoint3f			m_OriginalPosition;
	CPoint3f			m_AimPosition;
	CPoint3f			m_Normal;

	bool				m_bNormalSet;

	CMesh *				m_pParentMesh;

};

#endif // CVERTEX_H
